package 泛型.反省擦除;

public class GenericBase<T> {
	private T element;

	public T getElement() {
		return element;
	}

	public void setElement(T element) {
		this.element = element;
	}

	@SuppressWarnings("unchecked")
	public static void main(String[] args) {
		Drived2 drived2 = new Drived2();
		Object element = drived2.getElement();
		// warning 在set 的时候因为泛型已经擦除了类型，所以会报错。。
		drived2.setElement(element);
	}
}

class Drived1<T> extends GenericBase<T> {
}

// 没有警告
class Drived2 extends GenericBase {
}